package com.maxd.respository.userinfo;

import com.maxd.model.UserInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserJpaRepository extends JpaRepository<UserInfo, Long> {
    Long count(Specification<UserInfo> specification);

    /**
     * 获取授权会员用户
     *
     * @return
     */
    List<UserInfo> findAllByRelationIdNotNullOrderByIdDesc();

    /**
     * 获取未提现用户
     *
     * @return
     */
    List<UserInfo> findAllByRelationIdIsNullOrderByIdDesc();

    /**
     * 获取积分用户
     *
     * @return
     */
    List<UserInfo> findAllByOrderJifenNotNullOrderByIdDesc();

    Page<UserInfo> findAll(Specification<UserInfo> specification, Pageable pageable);

    List<UserInfo> findAll(Specification<UserInfo> specification);

}
